/* eslint-disable no-shadow */
/**
 * @func
 * @desc
 * @param {}
 * @return {}
 *//**
* @func 获取报表总数
*/
export function count({ search }, type) {
  const routePath = {
    order: 'order',
    ticket: 'operator.ticket',
  };
  return RSocket.rr({
    route: `cbv.excels.${routePath[type]}.count`,
    args: { search },
  });
}

/**
 * @func 获取报表数据
 */
export function search({ search, pg }, type) {
  const routePath = {
    order: 'order',
    ticket: 'operator.ticket',
  };

  return RSocket.rs({
    route: `cbv.excels.${routePath[type]}`,
    args: { search, pg, sort: ['crDate;desc'] },
  });
}

/**
 * @func 导出报表
 */
export function exportTable({ search }, type) {
  const routePath = {
    order: 'order',
    ticket: 'operator.ticket',
  };

  return RSocket.rs({
    route: `cbv.excels.${routePath[type]}.export`,
    args: { search },
    binary: true,
  });
}

/**
 * @func 获取总计数据
 */
export function totalInfo({ search }, type) {
  const routePath = {
    order: 'order',
    ticket: 'operator.ticket',
  };
  return RSocket.rr({
    route: `cbv.excels.${routePath[type]}.statistics`,
    args: { search },
  });
}

/**
 * @func 获取承运商数据
 */
export function fetchCompanyData() {
  return RSocket.rs({
    route: 'companys',
    args: {
      search: {
        isOperating: false,
      },
      pg: { page: 0, size: 999 },
    },
  });
}


/**
 * @func 获取司机数据
 */
export function fetchDriverData(search) {
  return RSocket.rs({
    route: 'drivers',
    args: {
      search,
      pg: { page: 0, size: 999 },
    },
  });
}
